package com.os.osframe.scaffold.util;

/**
 * Created by wangdc on 2015-4-27.
 */
public class ScaffoldUtil {
    public static String replaceStr(String srcText, String fromStr, String toStr) {
        if (srcText == null)
            return null;
        StringBuffer rtnVal = new StringBuffer();
        String rightText = srcText;
        for (int i = rightText.indexOf(fromStr); i > -1; i = rightText
                .indexOf(fromStr)) {
            rtnVal.append(rightText.substring(0, i));
            rtnVal.append(toStr);
            rightText = rightText.substring(i + fromStr.length());
        }
        rtnVal.append(rightText);
        return rtnVal.toString();
    }

}
